<?php namespace xlx\lib; 
class ArrayQueue implements \IteratorAggregate  {

    public $index = 0;
    public $items=null;
    public function __construct($arr=[]){
        $this->items = $arr;
    }
    public function push($item):int{
        $this->items[]=$item;
        return count($this->items)-1;
    }  
    public function splice($k,$l=1){ 
        array_splice($this->items,$k,$l); 
    }
    public function getIterator(){  
        for ($i=0,$len=count($this->items); $i < $len; $i++) 
            yield $i =>$this->items[$i]; 
    }
}